﻿using System;
using UtilZ.Dotnet.Ex.Model;

namespace UtilZ.Dotnet.Ex.Communication.Base
{
    /// <summary>
    /// 接收数据输出事件参数类
    /// </summary>
    public class DataOutputArgs : EventArgs, IDataOutputArgs
    {
        private LinkInfoAbs _linkInfo = null;
        /// <summary>
        /// 连接信息
        /// </summary>
        public LinkInfoAbs LinkInfo
        {
            get { return _linkInfo; }
        }

        private DataSource _data = null;
        /// <summary>
        /// 输出的数据
        /// </summary>
        public DataSource Data
        {
            get { return _data; }
            set { _data = value; }
        }



        /// <summary>
        /// 构造函数
        /// </summary>
        public DataOutputArgs()
        {
            
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="linkInfo">连接信息</param>
        public DataOutputArgs(LinkInfoAbs linkInfo)
        {
            this._linkInfo = linkInfo;
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="linkInfo">连接信息</param>
        /// <param name="data">数据</param>
        public DataOutputArgs(LinkInfoAbs linkInfo, DataSource data)
        {
            this._linkInfo = linkInfo;
            this._data = data;
        }


        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="linkInfo">连接信息</param>
        /// <param name="data">数据</param>
        public void Update(LinkInfoAbs linkInfo, DataSource data)
        {
            this._linkInfo = linkInfo;
            this._data = data;
        }
    }
}
